package ar.gov.hackaton.util;

import java.util.LinkedList;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import ar.gov.hackaton.controller.PersonController;
import ar.gov.hackaton.dao.CensoHogarDao;
import ar.gov.hackaton.model.CensoHogar;

public class CSVCensoHogar {
	
	private static final Logger logger = LoggerFactory.getLogger(CSVCensoHogar.class);

	
		private static String file = "/home/daniel/dev/hack-data/Indec/censo2010/censo2010-hogar.csv";
	
	public List<CensoHogar> loadData() {
		List<String[]> data = CSVReader.leer(file);
		List<CensoHogar> ret = new LinkedList<CensoHogar>();
		CensoHogar c = null;
		int i = 0;
		for (String[] a : data) {
			logger.debug("Procesando linea : "+i);		
			c = new CensoHogar();
			c.setProvinciaId(Long.valueOf(a[0]));
			c.setProvincia(a[1]);
			c.setDepartamentoId(Long.valueOf(a[2]));
			c.setDepartamento(a[3]);
			c.setCantCasa(Integer.valueOf(a[4]));
			c.setCantRancho(Integer.valueOf(a[5]));
			c.setCantCasilla(Integer.valueOf(a[6]));
			c.setCantDepartamento(Integer.valueOf(a[7]));
			c.setCantPiezaInquilinato(Integer.valueOf(a[8]));
			c.setCantHotel(Integer.valueOf(a[9]));
			c.setCantLocal(Integer.valueOf(a[10]));
			c.setCantMovil(Integer.valueOf(a[11]));
			c.setCantCalle(Integer.valueOf(a[12]));
			c.setCantTotal(Integer.valueOf(a[13]));
			c.setOcupacionPresente(Integer.valueOf(a[14]));
			c.setOcupacionTemporalAusente(Integer.valueOf(a[15]));
			c.setOcupacionAlquilerVenta(Integer.valueOf(a[16]));
			c.setOcupacionConstruccion(Integer.valueOf(a[17]));
			c.setOcupacionComercio(Integer.valueOf(a[18]));
			c.setOcupacionTemporal(Integer.valueOf(a[19]));
			c.setOcupacionOtra(Integer.valueOf(a[20]));
			c.setOcupacionTotal(Integer.valueOf(a[21]));
			c.setColectivaHogarAncianos(Integer.valueOf(a[22]));
			c.setColectivaHogarMenores(Integer.valueOf(a[23]));
			c.setColectivaColegioInternado(Integer.valueOf(a[24]));
			c.setColectivaObrador(Integer.valueOf(a[25]));
			c.setColectivaHospital(Integer.valueOf(a[26]));
			c.setColectivaPrision(Integer.valueOf(a[27]));
			c.setColectivaCuartel(Integer.valueOf(a[28]));
			c.setColectivaHogarReligioso(Integer.valueOf(a[29]));
			c.setColectivaHotel(Integer.valueOf(a[30]));
			c.setColectivaOtros(Integer.valueOf(a[31]));
			c.setColectivaTotal(Integer.valueOf(a[32]));
			c.setAreaUrbano(Integer.valueOf(a[33]));
			c.setAreaRuralAgrupado(Integer.valueOf(a[34]));
			c.setAreaRuralDisperso(Integer.valueOf(a[35]));
			c.setAreaTotal(Integer.valueOf(a[36]));
			c.setMaterialPisoCeramica(Integer.valueOf(a[37]));
			c.setMaterialPisoLadrillo(Integer.valueOf(a[38]));
			c.setMaterialPisoTierra(Integer.valueOf(a[39]));
			c.setMaterialPisoOtro(Integer.valueOf(a[40]));
			c.setMaterialPisoTotal(Integer.valueOf(a[41]));
			c.setMaterialExternoMembrana(Integer.valueOf(a[42]));
			c.setMaterialExternoBaldosa(Integer.valueOf(a[43]));
			c.setMaterialExternoTeja(Integer.valueOf(a[44]));
			c.setMaterialExternoMetal(Integer.valueOf(a[45]));
			c.setMaterialExternoPlastico(Integer.valueOf(a[46]));
			c.setMaterialExternoCarton(Integer.valueOf(a[47]));
			c.setMaterialExternoTabla(Integer.valueOf(a[48]));
			c.setMaterialExternoOtro(Integer.valueOf(a[49]));
			c.setMaterialExternoTotal(Integer.valueOf(a[50]));
			c.setRevestimientoSi(Integer.valueOf(a[51]));
			c.setRevestimientoNo(Integer.valueOf(a[52]));
			c.setRevestimientoTotal(Integer.valueOf(a[53]));
			c.setAguaDentroVivienda(Integer.valueOf(a[54]));
			c.setAguaDentroTerreno(Integer.valueOf(a[55]));
			c.setAguaFueraTerreno(Integer.valueOf(a[56]));
			c.setAguaTotal(Integer.valueOf(a[57]));
			c.setAguaBeberRed(Integer.valueOf(a[58]));
			c.setAguaBeberBombaMotor(Integer.valueOf(a[59]));
			c.setAguaBeberBombaManual(Integer.valueOf(a[60]));
			c.setAguaBeberPozo(Integer.valueOf(a[61]));
			c.setAguaBeberCisterna(Integer.valueOf(a[62]));
			c.setAguaBeberRio(Integer.valueOf(a[63]));
			c.setAguaBeberTotal(Integer.valueOf(a[64]));
			c.setLetrinaSi(Integer.valueOf(a[65]));
			c.setLetrinaNo(Integer.valueOf(a[66]));
			c.setLetrinaTotal(Integer.valueOf(a[67]));
			c.setCadenaSi(Integer.valueOf(a[68]));
			c.setCadenaNo(Integer.valueOf(a[69]));
			c.setCadenaTotal(Integer.valueOf(a[70]));
			c.setInodoroRed(Integer.valueOf(a[71]));
			c.setInodoroCamaraPozo(Integer.valueOf(a[72]));
			c.setInodoroSoloPozo(Integer.valueOf(a[73]));
			c.setInodoroHoyo(Integer.valueOf(a[74]));
			c.setInodoroTotal(Integer.valueOf(a[75]));
			c.setBanioExclusivo(Integer.valueOf(a[76]));
			c.setBanioCompartido(Integer.valueOf(a[77]));
			c.setBanioTotal(Integer.valueOf(a[78]));
			c.setCocinaGas(Integer.valueOf(a[79]));
			c.setCocinaGranel(Integer.valueOf(a[80]));
			c.setCocinaTubo(Integer.valueOf(a[81]));
			c.setCocinaGarrafa(Integer.valueOf(a[82]));
			c.setCocinaElectricidad(Integer.valueOf(a[83]));
			c.setCocinaCarbon(Integer.valueOf(a[84]));
			c.setCocinoOtro(Integer.valueOf(a[85]));
			c.setCocinaTotal(Integer.valueOf(a[86]));
			c.setHeladeraSi(Integer.valueOf(a[87]));
			c.setHeladeraNo(Integer.valueOf(a[88]));
			c.setHeladeraTotal(Integer.valueOf(a[89]));
			c.setPcSi(Integer.valueOf(a[90]));
			c.setPcNo(Integer.valueOf(a[91]));
			c.setPcTotal(Integer.valueOf(a[92]));
			c.setCelularSi(Integer.valueOf(a[93]));
			c.setCelularNo(Integer.valueOf(a[94]));
			c.setCelularTotal(Integer.valueOf(a[95]));
			c.setTelefonoLineaSi(Integer.valueOf(a[96]));
			c.setTelefonoLineaNo(Integer.valueOf(a[97]));
			c.setTelefonoTotal(Integer.valueOf(a[98]));
			c.setNbiSin(Integer.valueOf(a[99]));
			c.setNbiCon(Integer.valueOf(a[100]));
			c.setNbiTotal(Integer.valueOf(a[101]));
			c.setPropPropietarioAmbos(Integer.valueOf(a[102]));
			c.setPropPropietarioVivienda(Integer.valueOf(a[103]));
			c.setPropInquilino(Integer.valueOf(a[104]));
			c.setPropAPrestamo(Integer.valueOf(a[105]));
			c.setPropPorTrabajo(Integer.valueOf(a[106]));
			c.setPropOtro(Integer.valueOf(a[107]));
			c.setPropTotal(Integer.valueOf(a[108]));
			c.setHacinamiento050(Integer.valueOf(a[109]));
			c.setHacinamiento051099(Integer.valueOf(a[110]));
			c.setHacinamiento100149(Integer.valueOf(a[111]));
			c.setHacinamiento150199(Integer.valueOf(a[112]));
			c.setHacinamiento200300(Integer.valueOf(a[113]));
			c.setHacinamientoMas300(Integer.valueOf(a[114]));
			c.setHacinamientoTotal(Integer.valueOf(a[115]));
			ret.add(c);
			i++;
		}
		return ret;
	}
}
